<template>
  <el-dialog title="备注记录" :visible.sync="dialogVisible" width="1000px">
    <el-table :data="tableData" border>
      <el-table-column label="备注信息" prop="remark"></el-table-column>
      <el-table-column label="操作人员" prop="username" width="200"></el-table-column>
      <el-table-column label="时间" prop="create_time" width="200"></el-table-column>
    </el-table>
    <custom-page ref="customPage" :total="total" @getList="getList"></custom-page>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="dialogVisible = false">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getOrderRemark } from "@/api/order";
import customPage from "@/components/customPage";
export default {
  components: { customPage },
  props: ['orderId'],
  data() {
    return {
      dialogVisible: false,
      tableData: [],
      total: 0
    };
  },
  methods: {
    getList() {
      const { page, pageSize } = this.$refs.customPage;
      getOrderRemark({ page, pageSize, orderId: this.orderId }).then(res => {
        this.tableData = res.data || [];
        this.total = res.total || 0;
      })
    }
  },
  watch: {
    dialogVisible(val) {
      if (val) {
        this.$nextTick(() => {
          this.getList();
        })
      }
    }
  }
};
</script>

<style lang="scss" scoped></style>